package cn.qn.framwork.security;

import cn.qn.moudle.security.MemberAccount;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * Created by sang on 2017/12/30.
 */
public class MemberAccountUtils {
    public static MemberAccount getCurrentMember() {
        try {
            return (MemberAccount) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        }catch (ClassCastException e){
            return null;
        }
    }
}
